//
//  UIColor+PP.m
//  FileView-Simple
//
//  Created by 甘文鹏 on 2018/4/25.
//  Copyright © 2018年 ganwenpeng.com. All rights reserved.
//

#import "UIColor+PP.h"

@implementation UIColor (PP)
+ (instancetype)createWithRed:(NSInteger)red green:(NSInteger)green blue:(NSInteger)blue alpha:(CGFloat)alpha{
    // r g b 限制在 0~255
    red = MIN(255, MAX(0, red));
    green = MIN(255, MAX(0, green));
    blue = MIN(255, MAX(0, blue));
    // alpha 限制在 0~1
    alpha = MIN(1, MAX(0, alpha));
    
    return [UIColor colorWithRed:red/255.0 green:green/255.0 blue:blue/255.0 alpha:alpha];
}
@end
